import { MsdataTypes } from "../types/store";
import request from "../util";


export const addMainShi = (params:MsdataTypes)=>{
    return request.post<any,axiosTypes<addmsType>>('/app/addmainshi',params)
}

export const getMs = (phone:string)=>{
    return request.post<any,axiosTypes<addmsType[]>>("/app/getmyinterviews",{phone})
}

export const getmsbyid = (_id:string)=>{
    return request.post<any,axiosTypes<addmsType>>("/app/getmsbyid",{_id})
}
// 改变热度
export const changeHot = (_id:string,hot:number)=>{
    return request.post("/app/changemshot",{_id,hot})
}

// 查看是否已经点赞

export const userLikes = (phone:string,mid?:string)=>{
    return request.post<any,axiosTypes<getUserTypes[]>>('/app/getmslikes',{phone,mid})
}

// 添加到已经点赞
export const clickLikes = (phone:string,mid:string,msobj:addmsType)=>{
    return request.post<any,axiosTypes<getUserTypes[]>>("/app/addlikeone",{phone,mid,msobj})
}
// 改变点赞数据
export const changeLikes = (_id:string,likes?:number)=>{
    return request.post<any,axiosTypes<changeLikeType>>('/app/changemsinfo',{_id,likes})
}
// 删除已经点赞的数据
export const deleteLikes = (mid:string,phone:string)=>{
    return request.post<any,axiosTypes<deleteTpes>>("/app/dellikeone",{mid,phone})
}

// 查看是否已经收藏
export const userCol = (phone:string,mid?:string)=>{
    return request.post<any,axiosTypes<getUserTypes[]>>("/app/getcollectlist",{mid,phone})
}

// 添加收藏
export const addCol = (phone:string,mid:string,msobj:addmsType)=>{
    return request.post<any,axiosTypes<getUserTypes[]>>("/app/addcollectone",{phone,mid,msobj})
}

// 改变收藏数据
export const changeCol = (_id:string,collects:number)=>{
    return request.post('/app/changemsinfo',{_id,collects})
}
// 删除收藏
export const delCol = (mid:string,phone:string)=>{
    return request.post<any,axiosTypes<deleteTpes>>('/app/delcollectone',{mid,phone})
}

// 获取所有数据
export const getAll = ()=>{
    return request.post<any,axiosTypes<addmsType[]>>("/app/getallinters")
}

// 添加到已经评论中
export const addPings = (rate:number,comment:string,msobj:addmsType,time:Date,mid:string)=>{
    return request.post<any,axiosTypes<pingsType[]>>("/app/addpingsone",{mid,rate,comment,time,msobj})
}

// 获取评论列表
export const  getPings = (mid:string)=>{
    return request.post<any,axiosTypes<pingsType[]>>("/app/getpinglist",{mid})
}
// 获取评论列表
export const getPing = (phone:string)=>{
    return request.post<any,axiosTypes<pingsType[]>>("/app/getpinglist",{phone})
}
// 改变评论数据
export const changePings = (_id:string,pings?:number)=>{
    return request.post<any,axiosTypes<changeLikeType>>('/app/changemsinfo',{_id,pings})
}